package a_File1;

import org.testng.annotations.Test;

import java.io.File;
import java.io.IOException;

public class FileTest1 {
    public static void main(String[] args) {

    }
    @Test
    public void test(){
        File file = new File("j/a.txt");
        String path = file.getAbsolutePath();
        System.out.println(path);

        File file1 = new File("test/a/b/c","b.txt");
        String path1 = file1.getAbsolutePath();
        System.out.println(path1);

        File file2 = new File(new File("demo"),"c.txt");
        String path2 = file2.getAbsolutePath();
        System.out.println(path2);
    }
    @Test
    public void newFlieTest() throws IOException{
        File file = new File("a.txt");//  a/b/c/a.text
        String path = file.getAbsolutePath();
        System.out.println(path);
        file.createNewFile();
        String name = file.getName();
        System.out.println(name);
    }

}
